package com.yxc.plan.wolf.controller;

import com.yxc.plan.wolf.common.ServerResponse;
import com.yxc.plan.wolf.domain.Notice;
import com.yxc.plan.wolf.service.interfaces.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* @Description : 
* @Author      : abc@vanke.com
* @Date        : 2018-12-17 19:32
*/
@RestController
@RequestMapping(value = "/api/v1/notice")
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    @GetMapping(value = "/list")
    public ServerResponse<List<Notice>> list(@RequestParam("projectId") Long projectId, @PageableDefault(page = 0, size = 10, sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) {
        return noticeService.list(projectId, pageable);
    }
}
